import request from '@/utils/request'

// 获取指令类型下拉列表
export function getInstructionTypeList() {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/instruction_type_list',
    method: 'get'
  })
}

// 获取指令状态下拉列表
export function getInstructionStatusList() {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/instruction_status_list',
    method: 'get'
  })
}

// 获取目标厂站下拉列表
export function getReceiverStationList() {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/receiver_station_list',
    method: 'get'
  })
}

// 获取优先级下拉列表
export function getPriorityList() {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/priority_list',
    method: 'get'
  })
}

// 获取调度员下拉列表
export function getDispatcherList() {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/dispatcher_list',
    method: 'get'
  })
}

// 查询调度指令列表
export function getDispatchInstructionList(params) {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/all_list',
    method: 'get',
    params
  })
}

// 新增调度指令
export function addDispatchInstruction(data) {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction',
    method: 'post',
    data
  })
}

// 处理指令
export function handleDispatchInstruction(data) {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/handle',
    method: 'put',
    data
  })
}

// 获取调度指令详细信息
export function getDispatchInstructionDetail(instructionId) {
  return request({
    url: `/dispatch/dispatch/dispatchInstruction/${instructionId}`,
    method: 'get'
  })
}

// 导出调度指令列表
export function exportDispatchInstruction(params) {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/export',
    method: 'post',
    params,
    responseType: 'blob'
  })
}

// 导入调度指令
export function importDispatchInstruction(data) {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/import',
    method: 'post',
    data
  })
}

// 下载导入模板
export function downloadImportTemplate() {
  return request({
    url: '/dispatch/dispatch/dispatchInstruction/importTemplate',
    method: 'post',
    responseType: 'blob'
  })
}